{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Modeling and Simulation in Python\n",
    "\n",
    "\n",
    "Copyright 2017 Allen Downey\n",
    "\n",
    "License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Configure Jupyter so figures appear in the notebook\n",
    "%matplotlib inline\n",
    "\n",
    "# Configure Jupyter to display the assigned value after an assignment\n",
    "%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'\n",
    "\n",
    "# import functions from the modsim library\n",
    "from modsim import *"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Bigbelly"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://www.youtube.com/watch?v=frix_zTkPEs\n",
    "\n",
    "If the following import fails, open a terminal and run\n",
    "\n",
    "`conda install -c conda-forge pysolar`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysolar.solar import *"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from datetime import datetime, timedelta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.datetime(2018, 10, 29, 14, 13, 30, 886072)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dt = datetime.now()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.datetime(2018, 10, 29, 14, 13, 30, 886072, tzinfo=<StaticTzInfo 'EST'>)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pytz import timezone\n",
    "\n",
    "dt = pytz.timezone('EST').localize(dt)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "22.52017419635824"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_altitude(42.2931671, -71.263665, dt)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "781.1690621573555"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "latitude_deg = 42.3\n",
    "longitude_deg = -71.3\n",
    "altitude_deg = get_altitude(latitude_deg, longitude_deg, dt)\n",
    "azimuth_deg = get_azimuth(latitude_deg, longitude_deg, dt)\n",
    "radiation.get_radiation_direct(dt, altitude_deg)\n",
    "\n",
    "# result is in Watts per square meter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>values</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>lat_deg</th>\n",
       "      <td>42.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>lon_deg</th>\n",
       "      <td>-71.3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "lat_deg    42.3\n",
       "lon_deg   -71.3\n",
       "dtype: float64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "location = State(lat_deg=42.3, lon_deg=-71.3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.datetime(2017, 9, 15, 12, 30, tzinfo=<StaticTzInfo 'EST'>)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dt = datetime(year=2017, month=9, day=15, hour=12, minute=30)\n",
    "dt = pytz.timezone('EST').localize(dt)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def compute_irradiance(location, dt):\n",
    "    degree = UNITS.degree\n",
    "    watt = UNITS.watt\n",
    "    meter = UNITS.meter\n",
    "    \n",
    "    sun = State(\n",
    "        altitude_deg = get_altitude(location.lat_deg, location.lon_deg, dt),\n",
    "        azimuth_deg = get_azimuth(location.lat_deg, location.lon_deg, dt)\n",
    "    )\n",
    "\n",
    "    if sun.altitude_deg <= 0:\n",
    "        irradiance = 0\n",
    "    else:\n",
    "        irradiance = radiation.get_radiation_direct(dt, sun.altitude_deg)\n",
    "\n",
    "    sun.set(irradiance = irradiance * watt / meter**2)\n",
    "    return sun"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>values</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>altitude_deg</th>\n",
       "      <td>48.9295</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>azimuth_deg</th>\n",
       "      <td>199.128</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>irradiance</th>\n",
       "      <td>886.7325337613937 watt / meter ** 2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "altitude_deg                                48.9295\n",
       "azimuth_deg                                 199.128\n",
       "irradiance      886.7325337613937 watt / meter ** 2\n",
       "dtype: object"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sun = compute_irradiance(location, dt)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>values</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2017-09-15 00:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 00:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 00:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 01:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 01:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 01:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 01:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 02:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 02:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 02:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 02:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 03:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 03:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 03:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 03:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 04:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 04:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 04:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 04:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 05:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 05:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 05:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 05:45:00-05:00</th>\n",
       "      <td>32.163770</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 06:00:00-05:00</th>\n",
       "      <td>171.524281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 06:15:00-05:00</th>\n",
       "      <td>315.417455</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 06:30:00-05:00</th>\n",
       "      <td>430.773528</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 06:45:00-05:00</th>\n",
       "      <td>519.951046</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 07:00:00-05:00</th>\n",
       "      <td>589.344983</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 07:15:00-05:00</th>\n",
       "      <td>644.186729</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 07:30:00-05:00</th>\n",
       "      <td>688.226752</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 16:45:00-05:00</th>\n",
       "      <td>461.969588</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 17:00:00-05:00</th>\n",
       "      <td>355.515852</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 17:15:00-05:00</th>\n",
       "      <td>219.817019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 17:30:00-05:00</th>\n",
       "      <td>69.743423</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 17:45:00-05:00</th>\n",
       "      <td>0.218675</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 18:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 18:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 18:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 18:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 19:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 19:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 19:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 19:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 20:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 20:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 20:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 20:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 21:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 21:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 21:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 21:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 22:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 22:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 22:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 22:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 23:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 23:15:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 23:30:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-15 23:45:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-09-16 00:00:00-05:00</th>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>96 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "2017-09-15 00:15:00-05:00      0.000000\n",
       "2017-09-15 00:30:00-05:00      0.000000\n",
       "2017-09-15 00:45:00-05:00      0.000000\n",
       "2017-09-15 01:00:00-05:00      0.000000\n",
       "2017-09-15 01:15:00-05:00      0.000000\n",
       "2017-09-15 01:30:00-05:00      0.000000\n",
       "2017-09-15 01:45:00-05:00      0.000000\n",
       "2017-09-15 02:00:00-05:00      0.000000\n",
       "2017-09-15 02:15:00-05:00      0.000000\n",
       "2017-09-15 02:30:00-05:00      0.000000\n",
       "2017-09-15 02:45:00-05:00      0.000000\n",
       "2017-09-15 03:00:00-05:00      0.000000\n",
       "2017-09-15 03:15:00-05:00      0.000000\n",
       "2017-09-15 03:30:00-05:00      0.000000\n",
       "2017-09-15 03:45:00-05:00      0.000000\n",
       "2017-09-15 04:00:00-05:00      0.000000\n",
       "2017-09-15 04:15:00-05:00      0.000000\n",
       "2017-09-15 04:30:00-05:00      0.000000\n",
       "2017-09-15 04:45:00-05:00      0.000000\n",
       "2017-09-15 05:00:00-05:00      0.000000\n",
       "2017-09-15 05:15:00-05:00      0.000000\n",
       "2017-09-15 05:30:00-05:00      0.000000\n",
       "2017-09-15 05:45:00-05:00     32.163770\n",
       "2017-09-15 06:00:00-05:00    171.524281\n",
       "2017-09-15 06:15:00-05:00    315.417455\n",
       "2017-09-15 06:30:00-05:00    430.773528\n",
       "2017-09-15 06:45:00-05:00    519.951046\n",
       "2017-09-15 07:00:00-05:00    589.344983\n",
       "2017-09-15 07:15:00-05:00    644.186729\n",
       "2017-09-15 07:30:00-05:00    688.226752\n",
       "                                ...    \n",
       "2017-09-15 16:45:00-05:00    461.969588\n",
       "2017-09-15 17:00:00-05:00    355.515852\n",
       "2017-09-15 17:15:00-05:00    219.817019\n",
       "2017-09-15 17:30:00-05:00     69.743423\n",
       "2017-09-15 17:45:00-05:00      0.218675\n",
       "2017-09-15 18:00:00-05:00      0.000000\n",
       "2017-09-15 18:15:00-05:00      0.000000\n",
       "2017-09-15 18:30:00-05:00      0.000000\n",
       "2017-09-15 18:45:00-05:00      0.000000\n",
       "2017-09-15 19:00:00-05:00      0.000000\n",
       "2017-09-15 19:15:00-05:00      0.000000\n",
       "2017-09-15 19:30:00-05:00      0.000000\n",
       "2017-09-15 19:45:00-05:00      0.000000\n",
       "2017-09-15 20:00:00-05:00      0.000000\n",
       "2017-09-15 20:15:00-05:00      0.000000\n",
       "2017-09-15 20:30:00-05:00      0.000000\n",
       "2017-09-15 20:45:00-05:00      0.000000\n",
       "2017-09-15 21:00:00-05:00      0.000000\n",
       "2017-09-15 21:15:00-05:00      0.000000\n",
       "2017-09-15 21:30:00-05:00      0.000000\n",
       "2017-09-15 21:45:00-05:00      0.000000\n",
       "2017-09-15 22:00:00-05:00      0.000000\n",
       "2017-09-15 22:15:00-05:00      0.000000\n",
       "2017-09-15 22:30:00-05:00      0.000000\n",
       "2017-09-15 22:45:00-05:00      0.000000\n",
       "2017-09-15 23:00:00-05:00      0.000000\n",
       "2017-09-15 23:15:00-05:00      0.000000\n",
       "2017-09-15 23:30:00-05:00      0.000000\n",
       "2017-09-15 23:45:00-05:00      0.000000\n",
       "2017-09-16 00:00:00-05:00      0.000000\n",
       "Length: 96, dtype: float64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dt = datetime(year=2017, month=9, day=15)\n",
    "dt = pytz.timezone('EST').localize(dt)\n",
    "\n",
    "delta_t = timedelta(minutes=15)\n",
    "\n",
    "result = TimeSeries()\n",
    "for i in range(24 * 4):\n",
    "    dt += delta_t\n",
    "    sun = compute_irradiance(location, dt)\n",
    "    result[dt] = sun.irradiance.magnitude\n",
    "\n",
    "result"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fc5239869b0>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAELCAYAAAA2mZrgAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3Xl8VPW9//HXZCErJCQk7BDWjyAoZRF3BbcK1rrUtmqr3trW3rZ6W23t3tr+9Nq9rtervbZ20VattYu74lapiuCK4AeEIFuA7DGQhCzz++N7Jg5hyYTM5JyZ+TwfjzwC55yZvLPMfM53OycUDocxxhhjADL8DmCMMSY4rCgYY4zpZkXBGGNMNysKxhhjullRMMYY082KgjHGmG5WFIwxxnSzomCMMaabFQVjjDHdrCgYY4zpZkXBGGNMtyy/A8RCRHKAeUAV0OlzHGOMSRaZwEjgFVVti+UBSVEUcAXhX36HMMaYJHUc8EIsByZLUagCuPvuuxkxYoTfWYwxJils27aNCy+8ELz30FgkS1HoBBgxYgRjxozxO4sxxiSbmLvdbaDZGGNMNysKxhhjullRMMYY082KgjHGmG7JMtBszIDr6grT0tZBS1sHXV1hurz7mQ/KziR3UCa5g7LIyAj5nNKY+LKiYNJaY3MbG7Y2UVnVxNaaZqrrW9hRv4v6plZ2trTTFT7w44cUDKJkSC6lRbkML8ln7PDBjC0fzPiRQygenDMw34QxcWRFwaSNcDjM5h3NrFxXw8p1tbxdWUttY2v3/sK8bMpL8hk1rIAZE0sZnD+Iwvxs8nKyyMwIEQq5VsHu9k5a2jppaeugsbmN2sZWaptaWL2hjl2tHd3PN6I0n0PGlzBtQgmzpZwRpQUD/j0b01dWFExK6+wK886GOl5aWcVL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uCtbnqWq26KeYzCuD3ABbkDoV6maK8jZgporyNksV2plS0UDVhRE5BBVfUc/WDY+CHfP4TG4ecEA7+FuXvFJEfm9qn5qX8+lqu+LyJ+Aj6tqv26UEtRcQc4W1FxBzma5UitbKkt495G4O3D9D9CFu9/r/eouQjUduBV3zZEfApOBH+PuPDUHeEZVf7CP54tctTMlcwU5W1BzBTmb5UqtbOkgoVNSRWQK8BPcBaQ+g7vn8I0icqm6m6n/BBiGuwH9Pbg7dX0VaPW2Iz3uUxunF0QgcwU5W1BzBTmb5UqtbOki0d1HAozD3TKyCnhBRHKBL4jIFlV9TEQeB2ar6oqox3XgFpMk6hca1FxBzhbUXEHOZrlSK1taSHRRKMPdyze6cv8ImA+cIyJvq7sWf/cvV9zVC8cBX0/DXEHOFtRcQc5muVIrW1pI9IrmFcBcYBJ0zyJoA+7A3ee0IrJdRI4RkW/jbvr+HvBKGuYKcrag5gpyNsuVWtnSQkKLgqq+CTyHu5E7kVkEqnofrpUSuS9qCHdj+I/i7v60WFVr0i1XkLMFNVeQs1mu1MqWLgZiSuo3gBUicr6q/ilq+6u4KxdGrlr4NK6JOFCCmivI2YKaK8jZLFdqZUt5CS8K6m4M/jPgehFpBf4JFOKmk/0y0V8/2XIFOVtQcwU5m+VKrWzpYECukqqq3wKW4K5C+ATwGhAG/j0QXz/ZckFwswU1FwQ3m+XquyBnS3UDeZmLK4AZuLshNaq7+UUQBDUXBDdbUHNBcLNZrr4LcraUlZQ32THGGJMYSXWTHWOMMYllRcEYY0w3KwrGGGO6WVEwxhjTzYqCMcaYblYUjDHGdLOiYIwxppsVBWOMMd2sKBhjjOn2/wH9M+708WlrJgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "result.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "joule"
      ],
      "text/latex": [
       "$joule$"
      ],
      "text/plain": [
       "<Unit('joule')>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cm = UNITS.centimeter\n",
    "meter = UNITS.meter\n",
    "watt = UNITS.watt\n",
    "second = UNITS.second\n",
    "joule = UNITS.joule"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "45 centimeter"
      ],
      "text/latex": [
       "$45 centimeter$"
      ],
      "text/plain": [
       "<Quantity(45, 'centimeter')>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "width = 45 * cm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "2025 centimeter<sup>2</sup>"
      ],
      "text/latex": [
       "$2025 centimeter^{2}$"
      ],
      "text/plain": [
       "<Quantity(2025, 'centimeter ** 2')>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "area = width**2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "0.0 centimeter<sup>2</sup> watt/meter<sup>2</sup>"
      ],
      "text/latex": [
       "$0.0 \\frac{centimeter^{2} \\cdot watt}{meter^{2}}$"
      ],
      "text/plain": [
       "<Quantity(0.0, 'centimeter ** 2 * watt / meter ** 2')>"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "power = sun.irradiance * area"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "0.2025 meter<sup>2</sup>"
      ],
      "text/latex": [
       "$0.2025 meter^{2}$"
      ],
      "text/plain": [
       "<Quantity(0.2025, 'meter ** 2')>"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "area = area.to(meter**2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "0.0 watt"
      ],
      "text/latex": [
       "$0.0 watt$"
      ],
      "text/plain": [
       "<Quantity(0.0, 'watt')>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "power = sun.irradiance * area"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "0.0 second watt"
      ],
      "text/latex": [
       "$0.0 second \\cdot watt$"
      ],
      "text/plain": [
       "<Quantity(0.0, 'second * watt')>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "delta_t = 1 * second\n",
    "energy = power * delta_t"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "0.0 joule"
      ],
      "text/latex": [
       "$0.0 joule$"
      ],
      "text/plain": [
       "<Quantity(0.0, 'joule')>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "energy.to(joule)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
